package creatures;

import java.awt.Color;
import java.io.PrintStream;
import java.util.Scanner;
import engine.Game;
import engine.utils.Utils;

/**
 * A simple test Creature
 * 
 * @author Kyle_Solo
 */
public class Monster extends Creature {

	/**
	 * Default constructor for Monster
	 */
	public Monster() {
		character = "M";
		color = Color.red;
		speed = 1;
	}

	/**
	 * Normal constructor.
	 * 
	 * @param x
	 *            the Monster's starting x-coordinate in cells
	 * @param y
	 *            the Monster's starting y-coordinate in cells
	 */
	public Monster(int x, int y) {
		this();
		this.x = x;
		this.y = y;
	}

	@Override
	public String getSaveFilename() {
		return toString();
	}

	@Override
	public boolean load(Scanner data) {
		super.load(data);
		x = data.nextInt();
		y = data.nextInt();
		return true;
	}

	@Override
	public boolean save(PrintStream data) {
		super.save(data);
		data.append("" + x);
		data.append(" " + y);
		return true;
	}

	@Override
	public int update() {
		x += Utils.randomInt(-1, 1);
		y += Utils.randomInt(-1, 1);
		Game.messenger.sendMessage("The kobold takes a step!");
		return 10 / speed;
	}
}
